package com.ucar.train.dao;

import com.ucar.train.dto.RoleAndMenuDTO;
import com.ucar.train.dto.RoleDTO;

import com.ucar.train.vo.Menu;
import com.ucar.train.vo.Role;
import com.ucar.train.vo.RoleAndMenu;
import org.apache.ibatis.annotations.Param;
import org.springframework.cache.annotation.CacheEvict;
import org.springframework.cache.annotation.Cacheable;

import java.math.BigInteger;
import java.util.List;

public interface RoleMapper {

    /**
     * @Author zjm
     * @Description 获取所有角色信息
     * @Date 2019/7/25 10:36
     */
//    @Cacheable(cacheNames = "roles")
    List<RoleDTO> getAllRole();

    /**
     * @Author zjm
     * @Description 批量插入角色
     * @Date 2019/7/25 10:36
     */
//    @CacheEvict(cacheNames="roles",allEntries = true)
    Integer insertRoleList(@Param("list") List<Role> roles);

    /**
     * @Author zjm
     * @Description 新建角色
     * @Date 2019/7/25 10:36
     */
//    @CacheEvict(cacheNames="roles",allEntries = true)
    Integer insertRole(@Param("role") Role role);

    /**
     * @Author zjm
     * @Description 删除角色信息
     * @Date 2019/7/25 10:35
     */
//    @CacheEvict(cacheNames="roles",allEntries = true)
    Integer deleteRole(@Param("id") Long id);

    /**
     * @Author zjm
     * @Description 更新角色信息
     * @Date 2019/7/25 10:35
     */
//    @CacheEvict(value = "role",key = "'role'+#role.id",allEntries = true)
    Integer updateRole(@Param("role") Role role);

    /**
     * @Author zjm
     * @Description 获取指定角色的菜单
     * @Date 2019/7/25 10:35
     */
//    @Cacheable(value = "permission",key = "'permission'+#id")
    List<RoleAndMenuDTO> getRoleAndMenu();

//    @Cacheable(value = "role",key = "'role'+#id")
    RoleDTO getRoleById(@Param("id") Long id);

    List<RoleDTO> getByGroupId(@Param("groupId") Long groupId);

    List<RoleDTO> getNoPermission();
}
